﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace GameLibrary
{
    public abstract class StaticElement : IGameElement
    {
        #region Private Members
        private GamePanel m_owningGame = null;
        #endregion

        #region Protected Properties
        protected GamePanel OwningGame
        {
            get { return m_owningGame; }
        }
        #endregion

        #region Public Properties
        public Color Colour { get; set; }

        public RectangleF Rectangle { get; set; }

        public PointF Position
        { 
            get 
            { 
                return this.Rectangle.Location; 
            }
            set
            {
                this.Rectangle = new RectangleF(value, this.Rectangle.Size);
            }
        }

        public SizeF Size
        {
            get 
            { 
                return this.Rectangle.Size; 
            }
            set
            {
                this.Rectangle = new RectangleF(this.Rectangle.Location, value);
            }
        } 
        #endregion

        #region Constructor(s)
        public StaticElement(GamePanel owningGame, PointF position, SizeF size)
            : this(owningGame, new RectangleF(position, size))
        {
        }

        public StaticElement(GamePanel owningGame, RectangleF rectangle)
        {
            m_owningGame = owningGame;
            this.Rectangle = rectangle;
            this.Colour = Color.Red;
        }
        #endregion

        #region IGameElement Implementation
        public abstract void Draw(TimeSpan elapsedTime, Graphics g);
        public abstract void Update(TimeSpan elapsedTime);
        #endregion
    }
}
